﻿@using PerpetuumSoft.Knockout;
@model Open_Task_Request_System.Models.TaskListViewModel
@{
    ViewBag.Title = "TaskList";
    var ko = Html.CreateKnockoutContext();
}

@using (ko.Html.Form("SaveTask", "Task", null, new { id = "myform" }))
{
    <div id="formWrapper">
        <div class="label">
            @Html.LabelFor(m => m.Name)
        </div>
        <div class="edit">
            @ko.Html.TextBox(m => m.Name)
            @Html.ValidationMessageFor(m => m.Name)
        </div>
        <div class="label">
            @Html.LabelFor(m => m.Description)
        </div>
        <div class="edit">
            @ko.Html.TextArea(m => m.Description)
        </div>
        <div class="label">
            @Html.LabelFor(m => m.CategoryID)
        </div>
        <div class="edit">
            <select @ko.Bind.Value(m => m.CategoryID)>
                @{foreach (var category in Model.Categories)
                {
                    <option value="@category.Id"> @category.Name</option>
                }
                }
            </select>
        </div>
        <div class="label">
            @Html.LabelFor(m => m.RequestedPriorityLevel)
        </div>
        <div class="edit">
            <select @ko.Bind.Value(m => m.RequestedPriorityLevel)>
                <option>1</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option>10</option>
            </select>
        </div>
        <div class="label">
            @Html.LabelFor(m => m.Requester)
        </div>
        <div class="edit">
            @ko.Html.TextBox(m => m.Requester)
        </div>
        <div class="label">
            @Html.LabelFor(m => m.RequesterEmail)
        </div>
        <div class="edit">
            @ko.Html.TextBox(m => m.RequesterEmail)
        </div>
        <div class="label">
            @Html.LabelFor(m => m.DueDate)
        </div>
        <div class="edit">
            <input type="date" id="datepicker"  @ko.Bind.Value(m => m.DueDate) />
        </div>
        <div>
            <input type="submit" value="Click">
        </div>

    </div>

}
<script>
    $(function () {
        $("#datepicker").datepicker();
    });

    
</script>

@ko.Apply(Model)